package com.supermap.business.alltype;

import com.alibaba.dubbo.config.annotation.Reference;
import com.supermap.dataservice.util.JSONUtil;
import com.supermap.dubbo.api.alltype.AllTypeService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;

/**
 * @author lxs
 * @Title:当天各类统计的接口层
 * @Description:
 * @date 2018/8/2  11:59
 */
@Controller
@RequestMapping("AllTypeController")
public class AllTypeController {
    /**
     * 使用指定类初始化日志对象，在日志输出的时候，可以打印出日志信息所在类
     */
    protected static final Logger logger = LoggerFactory.getLogger(AllTypeController.class);
    @Reference(timeout = 10000)
    private AllTypeService allTypeService;

    @RequestMapping("getAllTypeList")
    @ResponseBody
    public JSONUtil getAllTypeList(HttpServletRequest request){
        String areaCode=request.getParameter("areaCode");
        return  allTypeService.getAllTypeList(areaCode);
    }

    /**
     * 根据区域获取各类农田注册总数
     * @param request
     * @return
     */
    @RequestMapping("getFarmCropNumByAreaCode")
    @ResponseBody
    public JSONUtil getFarmCropByAreaCode(HttpServletRequest request){
        String areaCode = request.getParameter("areaCode");
        return allTypeService.getFarmCropNumByAreaCode(areaCode);
    }
}
